<html>
<head><meta charset="utf-8"><title>mir inlining · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html">mir inlining</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="216942055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/216942055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#216942055">(Nov 16 2020 at 22:31)</a>:</h4>
<p>afaik with <a href="https://github.com/rust-lang/rust/issues/68965">#68965</a> being merged we should also be able to land <a href="https://github.com/rust-lang/rust/issues/77307">#77307</a> now.</p>
<p>There are still a few issues left here for which I don't have the capacity atm</p>



<a name="216942155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/216942155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#216942155">(Nov 16 2020 at 22:32)</a>:</h4>
<p>find out what to do with the <code>deeply-nexted</code> test which is currently taking 6000 times longer than before</p>



<a name="216942202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/216942202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#216942202">(Nov 16 2020 at 22:32)</a>:</h4>
<p>maybe look into <a href="https://github.com/rust-lang/rust/pull/77307#issuecomment-711033508">https://github.com/rust-lang/rust/pull/77307#issuecomment-711033508</a> and see where this negatively impacts runtime</p>



<a name="216942267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/216942267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#216942267">(Nov 16 2020 at 22:33)</a>:</h4>
<p>deal with <a href="https://github.com/rust-lang/rust/pull/77307#discussion_r506875059">https://github.com/rust-lang/rust/pull/77307#discussion_r506875059</a> so that we panic as expect in ranges</p>



<a name="216942399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/216942399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#216942399">(Nov 16 2020 at 22:34)</a>:</h4>
<p>I think <a href="https://github.com/rust-lang/rust/pull/77307#issuecomment-717931854">https://github.com/rust-lang/rust/pull/77307#issuecomment-717931854</a> can be explained by the fact that we sometimes inline and compute <code>optimize_mir</code> for functions which later become unreachable and are therefore never actually used <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="216942489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/216942489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#216942489">(Nov 16 2020 at 22:35)</a>:</h4>
<p>is someone interested in getting this finished instead of me or helping out with some of the issues here? Won't be able to do so myself in the near future</p>



<a name="216947948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/216947948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#216947948">(Nov 16 2020 at 23:33)</a>:</h4>
<p>I'm interested in helping out with MIR stuff in general, but I'm not sure if I am knowledgeable enough yet to help here.</p>



<a name="221088658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221088658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221088658">(Dec 28 2020 at 20:21)</a>:</h4>
<p>I had a look into the <a href="https://perf.rust-lang.org/compare.html?start=9832374f6e378971e1a933362cf9781b121bb845&amp;end=2f0d06e5b8f278ed4180d80b7b6be06be6da3b36">regressions</a>. <code>unicode_normalization-check</code> regresses because now check builds end up evaluating all the promoteds in <a href="https://github.com/rust-lang/rustc-perf/blob/85602978834fab00ceccbf122b714e544cfbf623/collector/benchmarks/unicode_normalization/src/tables.rs#L3858">https://github.com/rust-lang/rustc-perf/blob/85602978834fab00ceccbf122b714e544cfbf623/collector/benchmarks/unicode_normalization/src/tables.rs#L3858</a>. The <code>match-stress-opt</code> test is the one with the highest regression outside of <code>check</code> or <code>debug</code> tests.</p>
<p>What I am wondering is whether the issue is simply that we are inlining things like <code>Option::Some</code> calls. I think we should explore making <code>is_trivial_mir</code> return <code>false</code> for constructor functions for now. This could explain the huge regression in <code>unicode_normalization</code> as that has <em>lots</em> of <code>Some</code> calls paired with a promoted, which is pretty much exactly what we see in the <a href="https://perf.rust-lang.org/detailed-query.html?commit=2f0d06e5b8f278ed4180d80b7b6be06be6da3b36&amp;base_commit=9832374f6e378971e1a933362cf9781b121bb845&amp;benchmark=unicode_normalization-check&amp;run_name=full">regression details</a></p>



<a name="221090392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221090392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221090392">(Dec 28 2020 at 20:50)</a>:</h4>
<p>Those <code>Some</code> aren't really functions calls, are they? <code>((_0 as Some).0: &amp;[char]) = move _766</code></p>



<a name="221091310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221091310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221091310">(Dec 28 2020 at 21:04)</a>:</h4>
<p>To me this looks like asking for optimized mir and running const prop. Most likely cargo check didn't do before, since the number of <code>eval_to_allocation_raw</code> queries for check is pretty close to the debug build which didn't regress.</p>



<a name="221091966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221091966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221091966">(Dec 28 2020 at 21:16)</a>:</h4>
<p>Hmm... that could explain it, too, but that makes me wonder why we would even invoke <code>optimized_mir</code> on the caller (which obviously is happening, as there were <code>optimized_mir</code> invocations before this PR)</p>



<a name="221092255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221092255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221092255">(Dec 28 2020 at 21:21)</a>:</h4>
<p>cargo check is something like emit=metadata? I would expect this to include optimized mir for inline, generics, etc (but maybe it is unnecessary?)</p>



<a name="221093508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221093508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221093508">(Dec 28 2020 at 21:43)</a>:</h4>
<p>hmm.. that is true. I did want to figure out a way to run at least the const prop optimization so we get all lints in check builds, but maybe we can indeed just stop computing any <code>optimized_mir</code> queries once <a href="https://github.com/rust-lang/rust/pull/78407">https://github.com/rust-lang/rust/pull/78407</a> is merged (as then const eval does not need optimized mir)</p>



<a name="221093592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221093592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221093592">(Dec 28 2020 at 21:44)</a>:</h4>
<p>at least making the constructors not trivial doesn't seem to reduce the number of <code>eval_to_allocation_raw</code>, <code>eval_to_const_value_raw</code> and <code>normalize_generic_arg_after_erasing_regions</code> queries</p>



<a name="221093627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221093627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221093627">(Dec 28 2020 at 21:45)</a>:</h4>
<p>ok, then it can only be what <span class="user-mention" data-user-id="352985">@tm</span> suggested. An existing <code>optimized_mir</code> invocation that now invokes others due to actually performing inlining</p>



<a name="221093638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221093638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221093638">(Dec 28 2020 at 21:45)</a>:</h4>
<p>I don't know yet what is exact reason why we generate optimized mir for some items but not others, but we do generate it for closures, and some of those closures call those huge table like functions</p>



<a name="221093770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221093770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221093770">(Dec 28 2020 at 21:48)</a>:</h4>
<p>the logs around <a href="https://github.com/rust-lang/rust/pull/77307/files#diff-ac249da31a547009912230985d57c47e06fe681c000f94a9d785dd0f09654a4cR883">https://github.com/rust-lang/rust/pull/77307/files#diff-ac249da31a547009912230985d57c47e06fe681c000f94a9d785dd0f09654a4cR883</a> don't seem to show <code>Some</code> constructors during the build so maybe I changed something inconsequential though</p>



<a name="221093796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221093796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221093796">(Dec 28 2020 at 21:49)</a>:</h4>
<p>oh... interesting. We could debug this by adding an assertion to <code>optimized_mir</code> right now that triggers on non-const fn and closures if we are only emitting metadata. Then we can walk back the backtrace to see who wants optimized mir in check builds</p>



<a name="221095338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221095338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221095338">(Dec 28 2020 at 22:14)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> do you just want the query stack ?</p>



<a name="221095384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221095384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221095384">(Dec 28 2020 at 22:14)</a>:</h4>
<p>(or the literal backtrace)</p>



<a name="221095417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221095417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221095417">(Dec 28 2020 at 22:15)</a>:</h4>
<p>if both is available, I'll take both</p>



<a name="221095425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221095425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221095425">(Dec 28 2020 at 22:16)</a>:</h4>
<p>ok I can get those for you</p>



<a name="221095484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221095484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221095484">(Dec 28 2020 at 22:16)</a>:</h4>
<p>looking at <a href="http://encoder.rs">encoder.rs</a>, we unconditionally encode mir for closures, unlike other things which are usually gated on <code>should_codegen()</code></p>



<a name="221095521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221095521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221095521">(Dec 28 2020 at 22:17)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> it's just panicking on closures and ! const fn raw defids here right <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir/src/transform/mod.rs#L459">https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir/src/transform/mod.rs#L459</a> ?</p>



<a name="221095613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221095613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221095613">(Dec 28 2020 at 22:18)</a>:</h4>
<p>yea, pretty much. <span class="user-mention" data-user-id="352985">@tm</span> 's find looks like it could be the (or one of) the sources</p>



<a name="221095638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221095638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221095638">(Dec 28 2020 at 22:19)</a>:</h4>
<p>ah ok, I'll gather them in a sec just in case you see something useful though</p>



<a name="221095660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221095660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221095660">(Dec 28 2020 at 22:19)</a>:</h4>
<p>I was not expecting actual metadata writing to be the cause. I thought there would be reasons in just the regular code paths <span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span></p>



<a name="221095752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221095752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221095752">(Dec 28 2020 at 22:21)</a>:</h4>
<p>I wonder if we should also track our IOs, it could be interesting consumption metrics for these cases ?</p>



<a name="221095828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221095828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221095828">(Dec 28 2020 at 22:22)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> something like this ? <a href="https://gist.github.com/lqd/c3ca92718476f067e1ec6dd0ab1ef5aa">https://gist.github.com/lqd/c3ca92718476f067e1ec6dd0ab1ef5aa</a> :)</p>



<a name="221095928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221095928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221095928">(Dec 28 2020 at 22:24)</a>:</h4>
<p>exactly what I was looking for, thanks</p>



<a name="221095981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221095981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221095981">(Dec 28 2020 at 22:24)</a>:</h4>
<p>I did screw up the assertion description though. Only closures and functions that are not const. Because if I read that trace right, it's panicking on a <code>const</code> item.</p>



<a name="221096006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221096006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221096006">(Dec 28 2020 at 22:25)</a>:</h4>
<p>ah dang sorry</p>



<a name="221096349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221096349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221096349">(Dec 28 2020 at 22:31)</a>:</h4>
<p>backtrace for closure: <a href="https://gist.github.com/lqd/3ec30963e452d312d2e11b619ad4f1f6">https://gist.github.com/lqd/3ec30963e452d312d2e11b619ad4f1f6</a></p>



<a name="221096430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221096430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221096430">(Dec 28 2020 at 22:32)</a>:</h4>
<p>If <code>encode_info_for_closure</code> is first thing asking for optimized mir, that looks quite promising.</p>



<a name="221096465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221096465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221096465">(Dec 28 2020 at 22:33)</a>:</h4>
<p>looks like it indeed</p>



<a name="221096485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221096485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221096485">(Dec 28 2020 at 22:33)</a>:</h4>
<p>I'll try to gather a non-const fn now</p>



<a name="221096687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221096687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221096687">(Dec 28 2020 at 22:37)</a>:</h4>
<p>looks like the encoder again</p>



<a name="221096739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221096739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221096739">(Dec 28 2020 at 22:38)</a>:</h4>
<p><a href="https://gist.github.com/lqd/9fce456fa36f7210ec488c7cec3b4b17">https://gist.github.com/lqd/9fce456fa36f7210ec488c7cec3b4b17</a> for non-const fn <code>tables::canonical_fully_decomposed</code></p>



<a name="221096777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221096777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221096777">(Dec 28 2020 at 22:38)</a>:</h4>
<p>like <span class="user-mention" data-user-id="352985">@tm</span> said earlier, via a closure here as well</p>



<a name="221096813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221096813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221096813">(Dec 28 2020 at 22:39)</a>:</h4>
<p>if I'm understanding correctly ...</p>



<a name="221097027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221097027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221097027">(Dec 28 2020 at 22:43)</a>:</h4>
<p>jup, that looks like it... now the question is whether this is an oversight or whether this was needed. I'm guessing oversight as there's no explanation that I could find. So the fix seems easy enough, though I'm not sure how to properly test it.</p>



<a name="221098151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221098151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221098151">(Dec 28 2020 at 23:04)</a>:</h4>
<p>Generators use optimized mir for layout, but otherwise I don't see a reason why it would be required.</p>



<a name="221098381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221098381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221098381">(Dec 28 2020 at 23:08)</a>:</h4>
<p>you +don't see a reason ?</p>



<a name="221101385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221101385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221101385">(Dec 29 2020 at 00:12)</a>:</h4>
<p>avoiding encoding the closures how oli and tm said seems to bring the 3 queries back to their regular counts indeed</p>



<a name="221104871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221104871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221104871">(Dec 29 2020 at 01:31)</a>:</h4>
<p>here's how I interpreted your suggestions, but I could be wrong ^^ <a href="https://github.com/lqd/rust/commit/d390c926d9e8015fb4fe999ac87f7d7dde5cebe7">https://github.com/lqd/rust/commit/d390c926d9e8015fb4fe999ac87f7d7dde5cebe7</a> (though one can technically <code>#[inline(always)]</code> a closure, it's probably not necessary to check that here. Still, I left it in). I'll add a comment to the PR for <span class="user-mention silent" data-user-id="216206">lcnr</span>.</p>



<a name="221105070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221105070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221105070">(Dec 29 2020 at 01:36)</a>:</h4>
<p>(there seemed to be other cases where the optimized MIR was always encoded, I can't help but wonder if any of those are superfluous as well for check builds)</p>



<a name="221225962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221225962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221225962">(Dec 30 2020 at 16:48)</a>:</h4>
<p>Indeed, there seems to be a few more cases where mir is encoded unnecessarily. There are also attempts to encode mir for things which doesn't have any (but that should be harmless). <a href="https://github.com/rust-lang/rust/issues/78407">#78407</a> changes situation quite a bit, so might be nice to land that first.</p>



<a name="221227128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221227128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221227128">(Dec 30 2020 at 17:03)</a>:</h4>
<p>it seems oli rebased it recently and should be ready for review -- but since it's r? ghost, it might be time to assign someone to it</p>



<a name="221227636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221227636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221227636">(Dec 30 2020 at 17:08)</a>:</h4>
<p>yea <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span> I did request a reviewer in the t-compiler stream</p>



<a name="221228571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221228571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221228571">(Dec 30 2020 at 17:13)</a>:</h4>
<p>maybe wesley ?!</p>



<a name="221809513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221809513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221809513">(Jan 06 2021 at 19:16)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/80718">#80718</a> should address regression in unicode_nromalization-check, but it still waits for <a href="https://github.com/rust-lang/rust/issues/78407">#78407</a>. The deeply-nested issue can be avoided thorough an extra sprinkle of inline on trivial iterator impl for Empty.</p>



<a name="221824950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221824950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221824950">(Jan 06 2021 at 21:18)</a>:</h4>
<p>Explanation why adding extra <code>#[inline]</code> helps with with deeply-nested case: <a href="https://github.com/rust-lang/rust/issues/70749#issuecomment-755696221">https://github.com/rust-lang/rust/issues/70749#issuecomment-755696221</a></p>



<a name="221839128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221839128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221839128">(Jan 06 2021 at 23:42)</a>:</h4>
<p>(Is that the empty-chain-of-ZSTs test?  I hate that one, since the ZSTs and trivial <code>next</code> make it completely unrealistic...)</p>



<a name="221962611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/mir%20inlining/near/221962611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/mir.20inlining.html#221962611">(Jan 07 2021 at 16:18)</a>:</h4>
<p>That one exactly. Maybe we could remove it? It seems to cause a lot of trouble each time it goes haywire.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>